#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdlib.h>

int main()
{
  pid_t id = fork();
  if(id == 0)
  {
    int count = 5;
    while(count){
      printf("do child process!pid: %d ppid:%d, count:%d \n",\
          getpid(),getppid(),count--);
      sleep(1);
    }
    printf("child quit!\n");
    exit(1);
  }
  else if(id > 0)
  {
    while(1)
    {
      printf("do father process!...pid:%d , ppid: %d ...\n",getpid(),getppid());
      sleep(2);
    }
  }
  else
  {
    printf("fork error\n");
  }

  return 0;
}
